package com.rao.core.excel.typeHandler.impl;


import com.rao.core.excel.typeHandler.AbstractTypeHandler;
import org.apache.poi.ss.usermodel.Cell;

import java.lang.reflect.Field;
import java.util.Set;

/**
 * y轴为为文本格式
 */
public class StringTypeHandler extends AbstractTypeHandler {


    public StringTypeHandler(Set<Integer> columnIndexSet) {
        super(columnIndexSet);
    }

    @Override
    public boolean hand(Cell cell, int columnIndex, Field field, Object o) throws IllegalAccessException {
        if (this.columnIndexSet.contains(columnIndex)) {
            field.setAccessible(true);
            field.set(o, cell.getStringCellValue());
            return true;
        }
        return false;
    }
}
